Fix drag-and-drop to default to GDK_ACTION_MOVE if the drag is within a
authorHavoc Pennington <hp@redhat.com>
Tue, 14 Nov 2000 21:07:11 +0000 (21:07 +0000)
committerHavoc Pennington <hp@src.gnome.org>
Tue, 14 Nov 2000 21:07:11 +0000 (21:07 +0000)
2000-11-14  Havoc Pennington  <hp@redhat.com>

* gtk/gtktextview.c (gtk_text_view_drag_motion): Fix drag-and-drop
to default to GDK_ACTION_MOVE if the drag is within a single
widget. Defaults to GDK_ACTION_COPY between widgets.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtktextview.c

index 1098b9fc63ee479281da1895e933838be914fa59..eaf4432e6c38d36171c506e098f2641c36cbf58c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-11-14  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextview.c (gtk_text_view_drag_motion): Fix drag-and-drop
+       to default to GDK_ACTION_MOVE if the drag is within a single
+       widget. Defaults to GDK_ACTION_COPY between widgets.
+
 Mon Nov 13 14:43:48 2000  Owen Taylor  <otaylor@redhat.com>
 
        * demos/Makefile.am (test-inline-pixbufs.h): Fix srcdir != builddir
index 1098b9fc63ee479281da1895e933838be914fa59..eaf4432e6c38d36171c506e098f2641c36cbf58c 100644 (file)
@@ -1,3 +1,9 @@
+2000-11-14  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextview.c (gtk_text_view_drag_motion): Fix drag-and-drop
+       to default to GDK_ACTION_MOVE if the drag is within a single
+       widget. Defaults to GDK_ACTION_COPY between widgets.
+
 Mon Nov 13 14:43:48 2000  Owen Taylor  <otaylor@redhat.com>
 
        * demos/Makefile.am (test-inline-pixbufs.h): Fix srcdir != builddir
index 1098b9fc63ee479281da1895e933838be914fa59..eaf4432e6c38d36171c506e098f2641c36cbf58c 100644 (file)
@@ -1,3 +1,9 @@
+2000-11-14  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextview.c (gtk_text_view_drag_motion): Fix drag-and-drop
+       to default to GDK_ACTION_MOVE if the drag is within a single
+       widget. Defaults to GDK_ACTION_COPY between widgets.
+
 Mon Nov 13 14:43:48 2000  Owen Taylor  <otaylor@redhat.com>
 
        * demos/Makefile.am (test-inline-pixbufs.h): Fix srcdir != builddir
index 1098b9fc63ee479281da1895e933838be914fa59..eaf4432e6c38d36171c506e098f2641c36cbf58c 100644 (file)
@@ -1,3 +1,9 @@
+2000-11-14  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextview.c (gtk_text_view_drag_motion): Fix drag-and-drop
+       to default to GDK_ACTION_MOVE if the drag is within a single
+       widget. Defaults to GDK_ACTION_COPY between widgets.
+
 Mon Nov 13 14:43:48 2000  Owen Taylor  <otaylor@redhat.com>
 
        * demos/Makefile.am (test-inline-pixbufs.h): Fix srcdir != builddir
index 1098b9fc63ee479281da1895e933838be914fa59..eaf4432e6c38d36171c506e098f2641c36cbf58c 100644 (file)
@@ -1,3 +1,9 @@
+2000-11-14  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextview.c (gtk_text_view_drag_motion): Fix drag-and-drop
+       to default to GDK_ACTION_MOVE if the drag is within a single
+       widget. Defaults to GDK_ACTION_COPY between widgets.
+
 Mon Nov 13 14:43:48 2000  Owen Taylor  <otaylor@redhat.com>
 
        * demos/Makefile.am (test-inline-pixbufs.h): Fix srcdir != builddir
index 1098b9fc63ee479281da1895e933838be914fa59..eaf4432e6c38d36171c506e098f2641c36cbf58c 100644 (file)
@@ -1,3 +1,9 @@
+2000-11-14  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextview.c (gtk_text_view_drag_motion): Fix drag-and-drop
+       to default to GDK_ACTION_MOVE if the drag is within a single
+       widget. Defaults to GDK_ACTION_COPY between widgets.
+
 Mon Nov 13 14:43:48 2000  Owen Taylor  <otaylor@redhat.com>
 
        * demos/Makefile.am (test-inline-pixbufs.h): Fix srcdir != builddir
index 1098b9fc63ee479281da1895e933838be914fa59..eaf4432e6c38d36171c506e098f2641c36cbf58c 100644 (file)
@@ -1,3 +1,9 @@
+2000-11-14  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextview.c (gtk_text_view_drag_motion): Fix drag-and-drop
+       to default to GDK_ACTION_MOVE if the drag is within a single
+       widget. Defaults to GDK_ACTION_COPY between widgets.
+
 Mon Nov 13 14:43:48 2000  Owen Taylor  <otaylor@redhat.com>
 
        * demos/Makefile.am (test-inline-pixbufs.h): Fix srcdir != builddir
index bdb77b3d9433b6e0623e9beebeb4e46d97a972b7..4117f2a8ec493706296a984d880cdd2e7bab13ed 100644 (file)
@@ -3818,7 +3818,7 @@ gtk_text_view_drag_motion (GtkWidget        *widget,
   GtkTextIter end;
   GdkRectangle target_rect;
   gint bx, by;
-
+  
   text_view = GTK_TEXT_VIEW (widget);
 
   target_rect = text_view->text_window->allocation;
@@ -3836,8 +3836,8 @@ gtk_text_view_drag_motion (GtkWidget        *widget,
 
   gtk_text_layout_get_iter_at_pixel (text_view->layout,
                                      &newplace,
-                                     bx, by);
-
+                                     bx, by);  
+  
   if (gtk_text_buffer_get_selection_bounds (get_buffer (text_view),
                                             &start, &end) &&
       gtk_text_iter_in_range (&newplace, &start, &end))
@@ -3847,13 +3847,29 @@ gtk_text_view_drag_motion (GtkWidget        *widget,
       gtk_text_mark_set_visible (text_view->dnd_mark, FALSE);
     }
   else
-    {
+    {      
       if (gtk_text_iter_editable (&newplace, text_view->editable))
         {
+          GtkWidget *source_widget;
+          GdkDragAction suggested_action;
+          
+          suggested_action = context->suggested_action;
+          
+          source_widget = gtk_drag_get_source_widget (context);
+          
+          if (source_widget == widget)
+            {
+              /* Default to MOVE, unless the user has
+               * pressed ctrl or alt to affect available actions
+               */
+              if ((context->actions & GDK_ACTION_MOVE) != 0)
+                suggested_action = GDK_ACTION_MOVE;
+            }
+          
           gtk_text_mark_set_visible (text_view->dnd_mark,
                                      text_view->cursor_visible);
 
-          gdk_drag_status (context, context->suggested_action, time);
+          gdk_drag_status (context, suggested_action, time);
         }
       else
         {